<?php

/**
 * Role gateway
 *
 * @author    Mon Zafra <monzee at gmail>
 * @copyright (c)2009 Mon Zafra
 * @license   http://monzee.wordpress.com/license New BSD
 * @version   $Id: Roles.php 38 2009-02-18 17:12:39Z monzee $
 */
class Admin_Zdt_Roles extends Admin_Gateway_Zdt
{
    protected $_name = 'roles';
    protected $_rowClass = 'Admin_Zdt_RoleValue';
    protected $_rowsetClass = 'Admin_Zdt_RoleSet';

    public function getRoleBy($column, $value = null)
    {
        $select = $this->fetchBy($column, $value);

        return $this->fetchRow($select);
    }

    public function getRolesBy($column, $value = null)
    {
        $select = $this->fetchBy($column, $value);

        return $this->fetchAll($select);
    }

    /**
     * Returns the role with the specified id
     *
     * @param int $id
     * @return array
     */
    public function getById($id)
    {
        return $this->getRoleBy('id', $id)->toArray();
    }

}
